package com.guang.springbootjacson.bean;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;

/**
 * 序列化的时候可能导致的精度丢失问题：
 * 参考链接：https://blog.csdn.net/weixin_46099269/article/details/109350266?ops_request_misc=&request_id=&biz_id=102&utm_term=JsonFormat%E4%B8%AD%E7%9A%84shape&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-0-109350266.142^v11^control,157^v12^control&spm=1018.2226.3001.4187
 * @param <E>
 */
@JsonFormat(
    shape = JsonFormat.Shape.OBJECT
)
public class Page<E> implements List<E> {
    @JsonFormat(
            shape = JsonFormat.Shape.NUMBER
    )
    private final Integer totalCount;
    @JsonFormat(
            shape = JsonFormat.Shape.NUMBER
    )
    private final Integer currPage;
    @JsonFormat(
            shape = JsonFormat.Shape.NUMBER
    )
    private final Integer pageSize;
    @JsonFormat(
            shape = JsonFormat.Shape.ANY
    )
    private final List<E> result;

    public Page(Integer totalCount, Integer currPage, Integer pageSize, List<E> result) {
        this.totalCount = totalCount;
        this.currPage = currPage;
        this.pageSize = pageSize;
        this.result = result;
    }

    @Override
    public int size() {
        return 0;
    }

    @Override
    public boolean isEmpty() {
        return false;
    }

    @Override
    public boolean contains(Object o) {
        return false;
    }

    @Override
    public Iterator<E> iterator() {
        return null;
    }

    @Override
    public Object[] toArray() {
        return new Object[0];
    }

    @Override
    public <T> T[] toArray(T[] a) {
        return null;
    }

    @Override
    public boolean add(E e) {
        return false;
    }

    @Override
    public boolean remove(Object o) {
        return false;
    }

    @Override
    public boolean containsAll(Collection<?> c) {
        return false;
    }

    @Override
    public boolean addAll(Collection<? extends E> c) {
        return false;
    }

    @Override
    public boolean addAll(int index, Collection<? extends E> c) {
        return false;
    }

    @Override
    public boolean removeAll(Collection<?> c) {
        return false;
    }

    @Override
    public boolean retainAll(Collection<?> c) {
        return false;
    }

    @Override
    public void clear() {

    }

    @Override
    public E get(int index) {
        return null;
    }

    @Override
    public E set(int index, E element) {
        return null;
    }

    @Override
    public void add(int index, E element) {

    }

    @Override
    public E remove(int index) {
        return null;
    }

    @Override
    public int indexOf(Object o) {
        return 0;
    }

    @Override
    public int lastIndexOf(Object o) {
        return 0;
    }

    @Override
    public ListIterator<E> listIterator() {
        return null;
    }

    @Override
    public ListIterator<E> listIterator(int index) {
        return null;
    }

    @Override
    public List<E> subList(int fromIndex, int toIndex) {
        return null;
    }
}